<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp"%>
<script type="text/javascript" >

$(function(){
	$('#outboxGrid').datagrid({
	    url: ctx + '/pof/Mail!findByPage.action',
	    fit: true,
	    pagination: true,
	    queryParams:{'folderId':3},
	    rownumbers: true,
	    toolbar:'#button_index',
	    idField: 'sid',
	    onDblClickRow :function(rowIndex,rowData){
	    	CQOA.load('extendDiv',ctx+'/pof/Mail!detail.action',{'entity.sid':rowData.sid},function(){
				CQOA.hideDiv('mainDiv');
				CQOA.showDiv('extendDiv');
				$('#gridId').val('outboxGrid');
			});
	    }
	});
	
	
	$('#outboxDel').bind('click',function(){
		var row = $('#outboxGrid').datagrid('getSelected');
		if (!row) {
				$.messager.show({
					msg : '请选择一条数据'
				});
				return false;
		 }
		$.messager.confirm('提示信息','你确定要删除这条数据?',function(o){
				if(o){
					postcommit(ctx+'/pof/Mail!delete.action',{'entity.sid':row.sid},function(rel){
						if(rel.success){
							$('#outboxGrid').datagrid("unselectAll");
							$('#outboxGrid').datagrid('reload');
						}
						$.messager.show({
							msg : rel.msg
						});
					});
				}
			});
		
	});
	$('#outboxTrun').bind('click',function(){
		
	});
	$('#stitle').searchbox({
	    searcher:function(value,name){
	    	$('#outboxGrid').datagrid('reload',{
	    		'folderId':3,
	    		'entity.title':value
	    	});
	    },
	    prompt:'请输入标题'
	});
	
});

</script>
<div id="mainDiv" class="easyui-layout" fit="true" border="false">
	        <div id="easyui-title" style="display:none">
	            	发件箱
	        </div>
           <div class="top_toolbar_div" region="north" border="false">                
               <input id="stitle" style="width:300px" ></input>
            </div>
             <div id="button_index" class="top_toolbar_button_div" border="false">
                    <a href="#" class="easyui-linkbutton" id="outboxDel">删除</a>
                    <a href="#" class="easyui-linkbutton" id="outboxTrun">转发</a>
                </div>
            <div  region="center" border="false">
	           <table id="outboxGrid" title="邮件数据" border="false" fit="true" >
	               			<thead>
			                   <tr>
			                   	  <!-- 
			                      <th field="sid"  width="50">SID</th>
			                       -->
			                      <th checkbox="true"  width="50"></th>
			                      <th field="receiverCname"  width="100">收件人</th>
			                      <th field="title"  width="200">标题</th>
			                      <th field="sendTime"  width="150">时间</th>
			                   </tr>
	               			</thead>
	       	 	</table>
           </div>
</div>
<div id="extendDiv" class="easyui-panel" style="display:none;" fit="true" border="false"></div>


